package com.halfsword.creativecraft.block.custom.machine.blockentity.modules;

import net.minecraft.world.inventory.ContainerData;


public class DataAdapter implements ContainerData {
    private final ContainerData original;
    private final int count;

    public DataAdapter(ContainerData original, int count) {
        this.original = original;
        this.count = count;
    }

    @Override
    public int get(int index) {
        if (index < original.getCount()) {
            return original.get(index);
        }
        return 0;
    }

    @Override
    public void set(int index, int value) {
        if (index < original.getCount()) {
            original.set(index, value);
        }
    }

    @Override
    public int getCount() {
        return count;
    }
}